The coordinate system

One of the character of Flash movie is the local coordinate system.

Each movieClip has the property of _x,_y and _rotation. So that we can move or rotate the movieClip. But, be careful, this _x,_y and _rotation value is refferred to the parent coordinate system not the _root nor the screen.

If we continue make _x of a movieClip from _x=0 to _x=1,2,3,4,5... etc. Then if the _parent is a standstill movieClip, this movieClip will animate a movement from left to right. When the _parent movieClip is rotating, then the increase of _x will animate as a spiral out animation.

When we want to drag and snap two points in different coordinate, we need to convert these two points value into points value in a same coordinate. Usually the _parent coordinate of the movieClip that we want to move (set _x property).

We can use math to calculate and do conversion by ourself. The other way is use localToGlobal and globalToLocal function to convert between different coordinate system. This is handy when they are zoomed, scaled, rotated and moved. The math becomes very complicated.

However, I should add a final note. The conversion of points value by these two function are round to 1 decimals. The rounding effect will cause a big in-accuracy if this functions are called many many times.

I would use definite math if I want to change the points value forever. Usually, I use it for conditions that we need "display" the movieClip only. Then the internal value of the movieClip is not really changed.